<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>添加权限</title>
</head>
<body>
<div class="pd-20">
  <form action="" method="post" class="form form-horizontal" name="form1" id="form1">
    <div class="row cl">
        <input type="hidden" value="" name="pid" id="pid">
        <label class="form-label col-3"><span class="c-red">*</span>权限名称：</label>
        <div class="formControls col-4 s-msg">
            <input type="text" class="input-text" placeholder="权限名称" id="title" name="title" nullmsg="权限名称不能为空！" datatype="s1-16">
        </div>
        <div class="col-1"></div>
    </div>
    <div class="row cl">
        <label class="form-label col-3"><!-- <span class="c-red">*</span> -->权限规则：</label>
        <div class="formControls col-5 s-msg">
            <input type="text" class="input-text" placeholder="权限规则" id="name" name="name">
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-3"><!-- <span class="c-red">*</span> -->排序：</label>
        <div class="formControls col-3 s-msg">
            <input type="text" class="input-text" placeholder="0" id="sort" name="sort">
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-3"><!-- <span class="c-red">*</span> -->状态：</label>
        <div class="formControls col-8 s-msg" style="padding-top: 2px;">
            <div class="radio-box">
                <input type="radio" id="radio-1" name="status" value="1" checked>
                <label for="radio-1" class="lh-26">显示</label>
            </div>
            <div class="radio-box">
                <input type="radio" id="radio-2" name="status" value="0">
                <label for="radio-2" class="lh-26">不显示</label>
              </div>
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-3">附加条件：</label>
        <div class="formControls col-5">
            <input type="text" class="input-text" placeholder="附加条件" name="condition" id="condition">
        </div>
        <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <div class="col-9 col-offset-3">
        <input class="btn btn-primary radius" type="submit" id="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
      </div>
    </div>
  </form>
</div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 

<script type="text/javascript" src="lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script>
<script type="text/javascript" src="js/s.js"></script> 
<script type="text/javascript">
$(function(){
    
    var parentid=getUrlParam('parentid');//添加权限的父权限id
    var editid=getUrlParam('editid');//编辑权限id
    if(parentid==null && editid==null){
        $("#form1").attr("action", API_AUTH);
    }


    if(parentid!=null){
        // console.log(parentid);
        $("#form1").attr("action", API_AUTH);
        $("#pid").val(parentid);
    }



    if(editid!=null){
        
        var readurl=API_AUTH+"?id="+editid;
        $.getJSON(readurl,function(data){
            if(!checkStatus(data)) return;

            $("#title").val(data.datas.title);
            $("#name").val(data.datas.name);
             $("#sort").val(data.datas.sort);
            $("#condition").val(data.datas.condition);
            $("#form1").attr("action", readurl);
            $("#pid").val(data.datas.pid);
            if(data.datas.status=='0'){
                $("#radio-2").attr("checked","checked");
                $("#radio-1").attr("checked",false);
            }else{
                $("#radio-1").attr("checked","checked");
                $("#radio-2").attr("checked",false);
            }
     
            
        })
    }

	// $('.skin-minimal input').iCheck({
	// 	checkboxClass: 'icheckbox-blue',
	// 	radioClass: 'iradio-blue',
	// 	increaseArea: '20%'
	// });
	
	// $("#form1").Validform({
	// 	tiptype:2,
 //        ajaxPost:true,
	// 	callback:function(data){
 //            if(!checkStatus(data)) return;
 //            if(data.status=='1'){
 //               var index = parent.layer.getFrameIndex(window.name);
 //               parent.parent.layer.msg("操作成功", {icon:1,time:1000});
 //               parent.$('.btn-refresh').click();
 //               window.parent.location.reload();
 //               parent.layer.close(index);      
 //           }

	// 	}
	// });
    Validformsubmit("#form1");
});



</script>
</body>
</html>